<template>
  <div class="box">

    <!-- 左中box -->
    <HerinContainer
      class="MainCoal-box"
      :delay="1"
      direction="Left"
      title="传感器调校监测"
    >
      <div slot="tab" class="MainCoal-box-tab">
        <div
          v-for="(item, ind) in titleTwotab"
          :key="ind"
          :class="['btn', isTwobtn === item ? 'isbtn' : '']"
          @click="clickTwoTitleTab(item)"
        >
          {{ item }}
        </div>
      </div>
      <!-- 传感器调校监测 统计 -->
      <div :slot="Twocount" class="MainCoal-box-content">
        <div class="outage">
          <!-- 截割轨迹分析 -->
          <CoalCuttingChart x="key" y="value" :color="['#00FDFF']" :data="cutrateData" :text="['截割轨迹', '自动/手动']"/>
        </div>
      </div>
      <!-- 传感器调校监测  列表 -->
      <div :slot="Twolist" class="MainCoal-box-content" >
        <div class="outage">
          <!-- 采高分析 -->
          <TrackChart :data="TrackChartdata" :color="['#FFD101', '#00FDFF', '#34C8FF',]" unit="m"/>
        </div>
      </div>
    </HerinContainer>
  </div>
</template>
<script>
import HerinContainer from '@/components/HerinContainer';
import TrackChart from '@/components/chart/line/TrackChart.vue';
import CoalCuttingChart from '@/components/chart/line/CoalCuttingChart.vue';
import { cutAnalysis, rollerTrack } from '../common/titles';

export default {
  components: {
    HerinContainer,
    TrackChart,
    CoalCuttingChart
  },
  data() {
    return {
      cutAnalysisdata: cutAnalysis.seconddata,
      trackChartdata: rollerTrack.seconddata,
      count: 'content',
      Twocount: 'content',
      Twolist: '',
      titleTwotab: ['截割轨迹', '采高'],
      isTwobtn: '截割轨迹'
    };
  },
  mounted() {
    // console.log(this.CoalChartdata);
  },
  computed: {
    cutrateData() {
      const list = [...this.cutAnalysisdata].map(item => {
        return {
          s: ['当前支架', '自动/手动'],
          value: Number(item.value),
          key: item.key
        };
      });
      return list;
    },
    TrackChartdata() {
      const list = [...this.trackChartdata].map(item => {
        return {
          s: item.serice,
          y: Number(item.height),
          x: item.time
        };
      });
      return list;
    }
  },
  methods: {
    // 点击传感器调校监测tab  右中
    clickTwoTitleTab(item) {
      this.isTwobtn = item;
      if (item === '采高') {
        this.Twolist = 'content';
        this.Twocount = '';
      } else if (item === '截割轨迹') {
        this.Twolist = '';
        this.Twocount = 'content';
      }
    }
  }
};
</script>
<style lang="scss" scoped>
.MainCoal-box {
  margin-bottom: 10px;
  &-tab {
    display: flex;
    .btn {
      @include btn;
    }
    .isbtn {
      background-color: rgba(0, 228, 255, 0.2);
      color: $cyan;
    }
  }
  &-content {
    .mouldbox {
      margin-top: 30px;
    }
    .mouldbox:first-child {
      margin-top: 5px;
    }
  }
  .num {
    font-size: 1rem;
    text-align: right;
    font-family: Helvetica-bold;
    font-weight: 900;
  }
  .piece {
    color: rgba(131, 131, 131, 100);
    font-size: .75rem;
    text-align: left;
    font-family: Helvetica-regular;
    margin: 0 15px 0 5px;
    display: inline;
  }
  .sensorSum {
    display: flex;
    width: 330px;
    height: 40px;
    justify-content: space-between;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(16, 16, 16, 100);
    font-size: .875rem;
    padding: 0 10px;
    p {
      display: flex;
      align-items: center;
    }
    .sum {
      color: rgba(248, 248, 248, 100);
      font-size: .875rem;
      text-align: left;
      font-family: Helvetica-regular;
    }
  }
  .charttitle {
    font-size: 12px;
    color: $light2Grey;
    margin: 10px 0;
  }
  .outageList {
    .cont {
      justify-content: space-between;
      display: flex;
      p {
        align-items: center;
        display: flex;
      }
      .title {
        color: rgba(248, 248, 248, 100);
        font-size: .875rem;
        margin: 10px 0;
      }
    }
    .state {
      display: flex;
      justify-content: space-between;
      font-size: .75rem;
      color: rgba(173, 173, 173, 100);
    }
  }
  .broken {
    height: 38px;
    width: 330px;
    display: flex;
    justify-content: space-between;
    div {
      width: 160px;
      border-radius: .125rem;
      background-color: rgba(255, 255, 255, 0.1);
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-left: 10px;
    }
    .title {
      color: rgba(248, 248, 248, 100);
      font-size: .875rem;
    }
    .num {
      color: rgba(0, 253, 255, 100);
      font-size: 1rem;
      font-weight: 900;
    }
  }
  .sensorSort {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .chat {
      width: 137px;
      height: 119px;
    }
    .right {
      width: 130px;
      height: 119px;
      display: flex;
      flex-direction: column;
      align-content: space-between;
      p {
        margin: 0;
      }
      .point {
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
      }
      .title {
        color: rgba(173, 173, 173, 100);
        font-size: .75rem;
        margin: 0 12px 0 6px;
        display: inline-block;
        width: 36px;
      }
      .num {
        color: rgba(248, 248, 248, 100);
        font-size: .875rem;
        margin-right: 5px;
      }
    }
  }
  .outage {
    height: 136px;
  }
}
</style>
